package com.tekj.cxqcb.view.Module.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tekj.cxqcb.R;
import com.tekj.cxqcb.operation.resultBean.SelectAllForBusinessBean;

import java.util.List;

import common.tool.Tools;

/**
 * 购车意向adapter
 */
public class BuyingIntentionAdapter extends BaseQuickAdapter<SelectAllForBusinessBean.DataBean.ListBean, BaseViewHolder> {

    public BuyingIntentionAdapter(@Nullable List<SelectAllForBusinessBean.DataBean.ListBean> data) {
        super(R.layout.item_car_consultation, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SelectAllForBusinessBean.DataBean.ListBean item) {

        helper.addOnClickListener(R.id.tv_gz);

        helper.addOnClickListener(R.id.tv_type);

        helper.addOnClickListener(R.id.tv_phone);

        helper.setText(R.id.tv_time, "咨询时间：" + item.getCreateTime());

        helper.setText(R.id.tv_id, item.getId());

        helper.setText(R.id.tv_name, item.getNickname());

        helper.setText(R.id.tv_phone, item.getPhone());

//        Tools.setTextFlags2((TextView) helper.getView(R.id.tv_phone));

        helper.setText(R.id.tv_name2, item.getInfo());

        helper.setGone(R.id.img_new, item.getIsRead().equals("0"));

        helper.setBackgroundRes(R.id.tv_gz, item.getIsFollow() == 0 ? R.drawable.bg_red_25 : R.drawable.bg_red_kong_25);

        helper.setTextColor(R.id.tv_gz,
                mContext.getResources().getColor(item.getIsFollow() == 0 ? R.color.white : R.color.colorPrimary));
        helper.setText(R.id.tv_gz, item.getIsFollow() == 0 ? "特别关注" : "取消关注");

    }
}
